import * as types from './actionTypes';

export  function increment(increment) {
    return {
      type: types.INCREMENT,
      payload:increment || 1
    };
}

export function promise_increment(){
    return dispatch=>{
        const response =new Promise((resolve,reject)=>{
            setTimeout(()=>{
                resolve(10);
            },500)
        }) 
          response.then((data) => {
            dispatch(increment(data));
          })
    }
}

export function thunk_increment(){
    let args=arguments;
    return dispatch => {
        setTimeout(() => {
          dispatch(increment(...args));
        }, 1000);
      };
}